<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/WEB-INF/jsp/common/taglib.jsp" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE HTML>
<html>
<head>
    <%@include file="/WEB-INF/layouts/meta.jsp" %>
    <style type="text/css">
        body {
            overflow: hidden
        }

        .table-list {
            height: 256px;
        }
    </style>
</head>
<body id="mainId">
<div class="unit" id="groupUsers" style="height:580px" >
    <form id="form_page_param">
        <input type="hidden" id="resourceId" name="resourceId" value="${resourceId}"/>
        <input type="hidden" id="userId" name="userId" value="${userId}"/>
    </form>
    <input type="hidden" id="ctx" value="${ctxRoot}"/>
    <div class="row row_height_y">
        <div class="pull-right2">
            <form rel="groupUsers" action="${ctx}/query_hive_user_privilege_pop.do?resourceId=${resourceId}&userId=${userId}"
                  onsubmit="return search(this)" id="hiveaccessformid">
                <input type="hidden" name="divId_groupuser" value="${divId}"/>
                <input type="text" placeholder="用户名称" name="Q_LIKE_clusterUser.userName"
                       value="${param['Q_LIKE_clusterUser.userName']}"/>
                <input type="text" placeholder="租户名称" name="Q_LIKE_systemCompany.companyName"
                       value="${param['Q_LIKE_systemCompany.companyName']}"/>
                <span class="input-group-btn">
                    <button class="btn btn-info btn-minier" type="submit">
                        <i class="ace-icon glyphicon glyphicon-search"></i>
                    </button>
                </span>
            </form>
        </div>
    </div>
    <div class="table-responsive td_o table-responsive_f  table-list" style="height:85%">
        <table class="table table-striped table-bordered table-hover dataTable" id="table_privilege" >
            <thead>
            <tr>
                <%-- <th width="1%" class="center">
                     <label>
                         <input type="checkbox" class="ace" onclick="checkAll(this);"/>
                         <span class="lbl"></span>
                     </label>
                 </th>--%>
                <th class="center" width="5%">用户名</th>
                <th class="center" width="10%">租户名称</th>
                <th class="center" width="5%">用户类型</th>
                <th class="center" width="4%" title="查询" style="cursor: pointer;">SELECT</th>
                <th class="center" width="4%">ALL</th>
                <th class="center" width="4%">ALTER</th>
                <th class="center" width="4%">UPDATE</th>
                <th class="center" width="4%">CREATE</th>
                <th class="center" width="4%">DROP</th>
                <th class="center" width="4%">INDEX</th>
                <th class="center" width="4%">LOCK</th>
                <th class="center" width="4%">SHOW_DATABASE</th>
                <th class="center" width="7%">操作</th>
            </tr>
            </thead>

            <tbody>

            <c:forEach items="${page.list}" var="item">
                <tr id="${item.userId}">
                        <%--<td class="center">
                            <label>
                                <input type="checkbox" class="ace" name="id" value="${item.id}"/>
                                <span class="lbl"></span>
                            </label>
                        </td>--%>
                    <td>${item.userName}</td>
                    <td class="center">${item.companyName}</td>
                    <td class="center">${item.userTypeName}</td>
                    <td class="center"><input type="checkbox" value="1" <c:if test="${fn:contains(item.privilegeStr,',1,')}">checked="true"</c:if>></td>
                    <td class="center"><input type="checkbox" value="2" <c:if test="${fn:contains(item.privilegeStr,',2,')}">checked="true"</c:if>></td>
                    <td class="center"><input type="checkbox" value="3" <c:if test="${fn:contains(item.privilegeStr,',3,')}">checked="true"</c:if>></td>
                    <td class="center"><input type="checkbox" value="4" <c:if test="${fn:contains(item.privilegeStr,',4,')}">checked="true"</c:if>></td>
                    <td class="center"><input type="checkbox" value="5" <c:if test="${fn:contains(item.privilegeStr,',5,')}">checked="true"</c:if>></td>
                    <td class="center"><input type="checkbox" value="6" <c:if test="${fn:contains(item.privilegeStr,',6,')}">checked="true"</c:if>></td>
                    <td class="center"><input type="checkbox" value="7" <c:if test="${fn:contains(item.privilegeStr,',7,')}">checked="true"</c:if>></td>
                    <td class="center"><input type="checkbox" value="8" <c:if test="${fn:contains(item.privilegeStr,',8,')}">checked="true"</c:if>></td>
                    <td class="center"><input type="checkbox" value="9" <c:if test="${fn:contains(item.privilegeStr,',9,')}">checked="true"</c:if>></td>
                    <td class="center">
                        <button class="btn btn-minier btn-primary" type="button" onclick="editPrivilege('${item.userId}')" style="margin-left: 5%">编辑
                        </button>
                        <button class="btn btn-minier btn-primary" id="button_save" disabled="" type="button" onclick="savePrivilege('${item.userId}','${resourceId}','${item.hiveAccessId}')">保存
                        </button>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>
    <!-- /.table-responsive -->
    <div class="row row_height_x message-footer">
        <c:if test="${page != null}">
            <tags:page page="${page}"/>
        </c:if>
    </div>
</div>
<script src="${ctxRoot}/static/js_project/meta/hive/query_hive_user_privilege_pop.js"></script>

</body>
</html>